package com.go.where.family.service.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.go.where.family.constants.Constant;
import com.go.where.family.dao.ActivityDao;
import com.go.where.family.dao.ActivityRetrospectDao;
import com.go.where.family.dao.ActivitySignUpDao;
import com.go.where.family.dao.BigClassDao;
import com.go.where.family.dao.SmallClassDao;
import com.go.where.family.pojo.ActivityInfo;
import com.go.where.family.pojo.ActivityRetrospectInfo;
import com.go.where.family.pojo.ActivitySignupInfo;
import com.go.where.family.pojo.BigClassInfo;
import com.go.where.family.pojo.SmallClassInfo;
import com.go.where.family.service.ActivityService;

@Service("activityService")
public class ActivityServiceImpl implements ActivityService {

	@Resource(name = "activityDao")
	private ActivityDao activityDao;
	@Resource(name="bigClassDao")
	private BigClassDao bigClassDao;
	@Resource(name="smallClassDao")
	private SmallClassDao smallClassDao;
	@Resource(name = "activityRetrospectDao")
	private ActivityRetrospectDao activityRetrospectDao;
	@Resource(name = "activitySignUpDao")
	private ActivitySignUpDao activitySignUpDao;

	@Override
	public List<ActivityInfo> queryList(Map<String, Object> map) {
		return activityDao.queryT(map);
	}

	@Override
	public int update(ActivityInfo activityInfo) {
		activityInfo.setUpdateTime(new Date());
		return activityDao.update(activityInfo);
	}

	@Override
	public ActivityInfo queryActivityDetail(String activityId) {
		ActivityInfo act = new ActivityInfo();
		act.setActivityId(activityId);
		return activityDao.queryByPrimaryKey(act);
	}

	@Override
	public Integer queryCount(Map<String, Object> map) {
		return activityDao.queryCount(map);
	}

	@Override
	public List<ActivityRetrospectInfo> queryRetroList(Map<String, Object> map) {
		return activityRetrospectDao.queryT(map);
	}

	@Override
	public List<ActivitySignupInfo> querySignUpList(Map<String, Object> map) {
		return activitySignUpDao.queryT(map);
	}

	@Override
	public int saveSignup(ActivitySignupInfo activitySignupInfo) {
		activitySignupInfo.setSignUpTime(new Date());
		activitySignupInfo.setIsDelete(Constant.IS_NOT_DELETE);
		return activitySignUpDao.insert(activitySignupInfo);
	}

	@Override
	public int delete(ActivitySignupInfo activitySignupInfo) {
		activitySignupInfo.setIsDelete(Constant.IS_NOT_DELETE);
		return activitySignUpDao.update(activitySignupInfo);
	}

	@Override
	public List<BigClassInfo> queryBigClassList(Map<String, Object> map) {
		return bigClassDao.queryT(map);
	}

	@Override
	public List<SmallClassInfo> querySmallClassList(Map<String, Object> map) {
		return smallClassDao.queryT(map);
	}

}
